#!/usr/bin/env python

import nltk


# ---------partA
# saying='in the beginning God create the heaven and the earth .'
# sent = saying.split(' ')
# print sent
# pair = nltk.bigrams(sent)
# print list(pair)


def generate_model(cfdist, word, num=15):
	for i in range(num):
		print(word, ' ')
		word = cfdist[word].max()

text = nltk.corpus.genesis.words('english-kjv.txt')
print text[:3]
bigrams = nltk.bigrams(text)
print list(bigrams)[:3]
# cfd = nltk.ConditionalFreqDist(bigrams)
cfd = nltk.ConditionalFreqDist(list(bigrams))
print cfd['living']